<template>
	<view class="pageBox" :style="{paddingTop: statusBarHeight + 44 + 'px',}">
		<view class="topHead flex-between" :style="{top: statusBarHeight + 'px',}">
			<uni-icons type="back" size="24" @click="goBack"></uni-icons>
			<view class="title">
				原始仓单
			</view>
			<view class="right" @click="onRight">
				转换
			</view>
		</view>
		<view class="amount">
			<view class="amountTitle flex-center">
				原始仓单
			</view>
			<view class="amountTitle flex-center">
				{{total}}张
			</view>

			<view class="main">
				<view class="listBox">
					<view class="listTitle flex-row">
						<view class="title flex-row">
							交易所
						</view>
						<view class="title flex-row">
							票类
						</view>
						<view class="title flex-row">
							数量
						</view>
					</view>

					<view class="list">
						<view class="listItem flex" v-for="item in list" :key="item.id">
							<view class="item flex-row">
								{{item.exchangeInfo.parentInfo.name}}
							</view>
							<view class="item flex-row">
								<view class="itemText" v-if="item.exchangeInfo">
									{{item.exchangeInfo.name}}
								</view>

							</view>
							<view class="item flex-row">
								<view class="itemText">
									{{item.totalNum}} 张
								</view>
							</view>
						</view>
					</view>
					<u-loadmore :status="status" />
				</view>
			</view>
		</view>






	</view>
</template>

<script>
	export default {
		data() {
			return {
				statusBarHeight: "",
				lastId: 0,
				page: 1,
				list: [],
				end: false,
				status: 'loadmore',
				total: ''
			}
		},
		onLoad() {
			this.statusBarHeight = this.$mySysInfo().top;
			this.getList()
		},
		onReachBottom() {
			this.getList()
		},

		
		methods: {
			onRight() {
				uni.navigateTo({
					url: '/property/owrConversion'
				})
			},
			goBack() {
				const pages = getCurrentPages()
				if (pages.length === 1) {
					if (typeof params === 'number') {
						history.go(-params)
					} else {
						history.back()
					}
				} else {
					uni.navigateBack({
						delta: 1
					});
				}
			},
			getList() {
				if (this.end) {
					return
				}
				this.$post({
					module: 'Exchange',
					interface: 5005,
					data: {
						lastId: this.lastId,
						page: this.page,
					}
				}).then(res => {
					// console.log(res);
					this.list = [...this.list, ...res.list]
					this.total = res.total
					if (res.list.length < 10) {
						this.end = true
					}
					if (res.list.length < 10) {
						this.status = 'nomore';
					} else {
						this.status = 'loading';
					}
					this.page++
					this.lastId = res.lastId
				})
			}

		},
	}
</script>

<style scoped lang="scss">
	.pageBox {
		width: 100%;
		min-height: calc(100vh - var(--window-top));
		background-color: #ffffff;
		.topHead {
			background-color: #ffffff;
			height: 88rpx;
			width: 100%;
			padding: 0 32rpx;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 3;
		
			.title {
				font-size: 32rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #000000;
				position: absolute;
				top: 22rpx;
				left: 50%;
				transform: translate(-50%, 0);
			}
		
			.right {
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #F2615F;
			}
		}

		.amount {
			width: 100%;
			height: 288rpx;
			background-image: url("http://www.bobei.shop/static/third/topHeadBg.png");
			background-repeat: no-repeat;
			background-size: 100% 100%;
			padding-top: 60rpx;
			position: relative;

			.amountTitle {
				font-size: 36rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: normal;
				color: #FFFFFF;
				margin-top: 16rpx;
			}

			.main {
				width: 100%;
				background: #FFFFFF;
				border-radius: 24rpx 24rpx 0px 0px;
				position: absolute;
				left: 0;
				top: 268rpx;
				z-index: 1;
				padding: 0 30rpx;
				



				.listBox {
					width: 100%;
					margin-top: 38rpx;

					.listTitle {
						.title {
							font-size: 36rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: bold;
							color: #000000;
							line-height: 40rpx;
						}

						.title:nth-of-type(1) {
							width: 26%;
						}

						.title:nth-of-type(2) {
							width: 38%;
						}

						.title:nth-of-type(3) {
							width: 36%;
						}
					}

					.list {
						padding-top: 20rpx;

						.listItem {
							align-items: flex-start;
							.item {
								font-size: 28rpx;
								font-family: PingFangSC-Regular, PingFang SC;
								font-weight: 400;
								color: #000000;
								line-height: 40rpx;
								margin-top: 28rpx;
								word-break: break-all;
							}

							.item:nth-of-type(1) {
								width: 26%;
							}

							.item:nth-of-type(2) {
								width: 38%;
							}

							.item:nth-of-type(3) {
								width: 36%;
							}
						}
					}
				}
			}
		}



	}
</style>
